import { defineStore } from "pinia";
import { store } from "./index";
import { cloneDeep } from "lodash-es";
import { flatMultiLevelRoutes } from "@/utils/routerHelper";
export const usePermissionStore = defineStore("permission", {
  state: () => ({
    routers: [],
    addRouters: [],
    isAddRouters: false,
    menuTabRouters: [],
  }),
  getters: {
    getAddRouters() {
      return flatMultiLevelRoutes(cloneDeep(this.addRouters));
    },
  },
});
export const usePermissionStoreWithOut = () => usePermissionStore(store);
